package com.xhl.doeverything.entity;//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

import java.util.Collections;
import java.util.List;

public class PageQueryResult<T> {
    private List<T> records = Collections.emptyList();
    private int total = -1;
    private int size = 10;
    private int current = 1;

    public boolean hasPrevious() {
        return this.current > 1;
    }

    public boolean hasNext() {
        return this.current < this.getPages();
    }

    public int getPages() {
        if (this.getSize() == 0) {
            return 0;
        } else {
            int pages = this.getTotal() / this.getSize();
            if (this.getTotal() % this.getSize() != 0) {
                ++pages;
            }

            return pages;
        }
    }

    public PageQueryResult() {
    }

    public List<T> getRecords() {
        return this.records;
    }

    public int getTotal() {
        return this.total;
    }

    public int getSize() {
        return this.size;
    }

    public int getCurrent() {
        return this.current;
    }

    public void setRecords(final List<T> records) {
        this.records = records;
    }

    public void setTotal(final int total) {
        this.total = total;
    }

    public void setSize(final int size) {
        this.size = size;
    }

    public void setCurrent(final int current) {
        this.current = current;
    }


    protected boolean canEqual(final Object other) {
        return other instanceof PageQueryResult;
    }

}
